//
//  JiJiangJieXiaoCell.swift
//  HappyEat
//
//  Created by ctx2016 on 17/1/10.
//  Copyright © 2017年 陌路是我. All rights reserved.
//

import UIKit

class JiJiangJieXiaoCell: UITableViewCell {
    var mainImae:UIImageView = UIImageView.init()
    var nameLabel:UILabel = UILabel.init()
    var addLabel:UILabel = UILabel.init()
    var icon_jiexiao:UIImageView = UIImageView.init(image: UIImage.init(named: "jijiang_jiexiao"))
    var timeLabel:UILabel = UILabel.init()
    var sepLabel:UILabel = UILabel.init()
    override func awakeFromNib() {
        super.awakeFromNib()
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        self.mainImae.snp.makeConstraints { (make) in
            make.size.equalTo(CGSize.init(width: 100, height: 75))
            make.top.equalTo(12)
            make.left.equalTo(16)
        }
        self.nameLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.mainImae.snp.right).offset(16)
            make.right.equalTo(-16)
            make.top.equalTo(12)
            make.height.equalTo(16)
        }
        self.icon_jiexiao.snp.makeConstraints { (make) in
            make.right.equalTo(-16)
            make.top.equalTo(26)
            make.size.equalTo(CGSize.init(width: 60, height: 18))
        }
        self.addLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.mainImae.snp.right).offset(16)
            make.right.equalTo(self.icon_jiexiao.snp.left).offset(0)
            make.height.equalTo(12)
            make.top.equalTo(self.nameLabel.snp.bottom).offset(8)
        }
        self.timeLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.mainImae.snp.right).offset(0)
            make.right.equalTo(0)
            make.height.equalTo(24)
            make.top.equalTo(self.addLabel.snp.bottom).offset(22)
        }
        self.sepLabel.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.bottom.equalTo(0)
            make.height.equalTo(0.5)
        }
    }
}
extension  JiJiangJieXiaoCell{
    func setUI(){
       self.contentView.addSubview(self.mainImae)
        self.contentView.addSubview(self.nameLabel)
        self.contentView.addSubview(self.icon_jiexiao)
        self.contentView.addSubview(self.addLabel)
        self.contentView.addSubview(self.timeLabel)
        self.contentView.addSubview(self.sepLabel)
        self.mainImae.backgroundColor = .black
        self.nameLabel.font = UIFont.systemFont(ofSize: 16)
        self.addLabel.font = UIFont.systemFont(ofSize: 12)
        self.addLabel.textColor = .lightGray
        self.timeLabel.textColor = .red
        self.timeLabel.font = UIFont.systemFont(ofSize: 24)
        self.timeLabel.textAlignment = .center
        self.sepLabel.backgroundColor = .lightGray
    }
}
